import { CSSProperties, memo } from 'react';
import { getToken } from '@inbiz/utils';

function Avatar(props: { userId: any; style: CSSProperties | undefined; }) {
  return (
    <div>
      <img
        src={`${InbizConfig.HOST}/Imagetype/GetUserAvatar?token=${getToken()}&userId=${
          props.userId
        }&flag=${new Date().getTime()}`}
        onError={(e) => {
          e.target.onerror = null;
          e.target.src = `/inbiz/admin/image/default.png`;
        }}
        style={{ borderRadius: '50%', verticalAlign: 'middle', marginRight: 20, ...props.style }}
      />
    </div>
  );
}

export default memo(Avatar);
